<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
$_LangPath = 'innerindex';	//語言檔參數，務必放在最前面
include_once("../config.inc.php");
session_start();
include_once(__Member_Path."/logincheck_nodb.php");
include_once(__Language_Path."/selectlanguage_member.php");
include_once(__Common_Path."/Lotto.inc.php");
include_once(__Modules_Path."/Lotto.lib.php");

$objMember = $_SESSION["Member_Info"];
$intLID = (int)$_data["LottoID"];
if(empty($intLID)){
	$intLID = (defined('__MemInitLottoID'))?__MemInitLottoID:1;
	if(empty($intLID))$intLID = 1;
}



$fp = @file(__Root_Path."/indexpage/index_member.html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);
$fp = str_replace("{UserID}", $_SESSION["Member_Info"] -> ID, $fp);
$fp = str_replace("{time}", "103", $fp);
$fp = str_replace("{sid}", $_data["sid"], $fp);
$fp = str_replace("../membertemplate/", "", $fp);
$fp = str_replace(".html?", ".php?", $fp);
$fp = str_replace("{LID}", $intLID, $fp);

$strLCon = "";
$arrLottoPower = getLottoUsePowerArray($objMember -> GamePower);
sort($arrLottoPower);

preg_match("/<!-- Lotto@bof \/\/-->(.+)<!-- Lotto@eof \/\/-->/s", $fp, $arrLCon);
foreach($arrLottoPower as $intLottoID){
	$strTmp = $arrLCon[1];

	$arrLotto = $_arrLotto[$intLottoID];
	$strTmp = str_replace("{Lotto}", $arrLotto["Lotto_".$_intLang], $strTmp);
	$strTmp = str_replace("{ItemLID}", $intLottoID, $strTmp);

	if($intLottoID == $intLID){
		$fp = str_replace("{NowLotto}", $arrLotto["Lotto_".$_intLang], $fp);
		$fp = str_replace("{NowLID}", $intLID, $fp);
		$strTmp = str_replace("noneclass", "lottofocus", $strTmp);
	}
	$strLCon .= $strTmp."\n";
}
$fp = preg_replace("/<!-- Lotto@bof \/\/-->.+<!-- Lotto@eof \/\/-->/s", $strLCon, $fp);

switch($intLID){
	case 2:
	case 3:
	case 6:
	case 7:
	case 8:
		$fp = str_replace("specialnumber_o", "number51", $fp);
		break;

	case 4:
		$fp = str_replace("specialnumber_o", "7star1", $fp);
		break;

	case 5:
		$fp = str_replace("specialnumber_o", "10m1", $fp);
		break;

	default:
		$fp = str_replace("specialnumber_o", "specialnumber", $fp);
		$fp = str_replace("stype=o", "stype=c", $fp);
		break;
}

$fp = str_replace("{ShowUserAcc}", $objMember -> Account, $fp);

while(list($k, $v) = each($_strInnerIndex)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

$arrBet_Type = $_arrBet_Type[$intLID];
foreach($arrBet_Type as $intBT => $strBT){
	$_SESSION["Member_Info"] -> arrEventLimit[$intLID][$intBT] = 99999999;
	$_SESSION["Member_Info"] -> arrBetLimit[$intLID][$intBT] = 99999999;
}

//從平台取得以使用信用額度  退水參數  各階層成數 
$objUData = getPFMemberUCreditParamScale($_SESSION["Member_PFSID"], $objMember, $intLID);
if($objUData === false)ErrMsgOutputHTML("Error", "", 1);

//載入退水
$arrComm = getPFMemberParamToLotto($intLID, $objMember -> Game_Type, (array)$objUData -> ParamInfo);
$_SESSION["Member_Info"] -> arrCommission = $arrComm[$objMember -> ID];
$_SESSION["Member_Info"] -> arrSubCommission = $arrComm[$objMember -> SubID];
$_SESSION["Member_Info"] -> arrMainCommission = $arrComm[$objMember -> MainID];
$_SESSION["Member_Info"] -> arrStockCommission = $arrComm[$objMember -> StockID];
$_SESSION["Member_Info"] -> arrDirectorCommission = $arrComm[$objMember -> DirectorID];
$_SESSION["Member_Info"] -> arrLayer6Commission = $arrComm[$objMember -> Layer6ID];

//載入成數
$arrScale = getPFMemberScaleToLotto($objMember, (array)$objUData -> PreScale);
if($arrScale === false)ErrMsgOutputHTML("Scale To Lotto Error", "", 1);

$_SESSION["Member_Info"] -> SubScale = $arrScale[1][2];
$_SESSION["Member_Info"] -> MainScale = $arrScale[1][3];
$_SESSION["Member_Info"] -> StockScale = $arrScale[1][4];
$_SESSION["Member_Info"] -> DirectorScale = $arrScale[1][5];
$_SESSION["Member_Info"] -> Layer6Scale = $arrScale[1][6];
$_SESSION["Member_Info"] -> LayerScale = $arrScale;


$intBalenceCredit = number_format($_SESSION["Member_Info"] -> CreditLine + $objUData -> UsedCredit);
$fp = str_replace("{ShowCredit}", $intBalenceCredit, $fp);

//輸出
WebOutputHTML($fp, 1);
?>